<?php

class Validator
{
    public static function isEmpty(&$data)
    {
	if (strlen(trim($data)) == 0) return(true);	
	return(false);
    }    
    
    public static function isAlphabetic(&$data)
    {
	return(preg_match("|^[a-zA-Z[:space:]]*$|", $data));
    }    
    
    public static function isNumerical(&$data)
    {
	return preg_match("|^[0-9]*$|", $data);
    }        
    
    public static function isEmail(&$data)
    {
	return(preg_match('#^([a-zA-Z0-9_\\-\\.]+)@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.)|(([a-zA-Z0-9\\-]+\\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\\]?)$#',$data));
    }

    public static function isDate(&$data)
    {
	    return ereg("([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})", $data);
    }
}

?>
